package remotecontrol;



import java.awt.AWTException;
import java.awt.Robot;
import java.io.UnsupportedEncodingException;
import java.net.UnknownHostException;

import javax.swing.JButton;
import javax.swing.JFrame;

import Model.PlayerModel;
import Model.Volume;
import View.PlayerView;
import onebeartoe.AppModes;
import onebeartoe.juke.services.CurrentSongService;
import onebeartoe.juke.services.NoPersistenceSongsPlayedService;
import onebeartoe.juke.services.RegularCurrentSongService;
import onebeartoe.juke.services.SongsPlayedService;
import onebeartoe.juke.songs.SongListManager;
import remotecontrol.Connect;
import remotecontrol.ThreadedServer;


public class RandomJukeMain extends JFrame {
	
    private static final long serialVersionUID = 0xaaa8753L;
    static SongListManager songListManager;
    static SongsPlayedService songsPlayedService;
    static CurrentSongService currentSongSerice;
    static String currentSongTitle;
    private JButton nextSongButton;
    private ThreadedServer nextSongServer;
    private AppModes appMode;
    private static int checkMouseLock;
   
    public RandomJukeMain() throws UnknownHostException, UnsupportedEncodingException
    {      
        setVisible(false);
        Connect randomJukeServerConnection = new Connect();
        randomJukeServerConnection.appMode = appMode;
        randomJukeServerConnection.setNextSongButton(nextSongButton);
        randomJukeServerConnection.setCurrentSongService(currentSongSerice);
        randomJukeServerConnection.setApp(this);
        nextSongServer = new ThreadedServer();
        nextSongServer.setConnection(randomJukeServerConnection);
        nextSongServer.start();
    }

    public void play(){
    	PlayerModel.getInstance().playPause();
    }

    public void playNextSong(){
        PlayerModel.getInstance().next();
    }
    
    public void playPreviousSong(){
    	PlayerModel.getInstance().prev();
    }
    
    public void volumedown(){
    	PlayerView.setVolume.setValue(0);
    	Volume.setVolume(0.0f);
    }
    
    public void volumemax(){
    	PlayerView.setVolume.setValue(100);
    	Volume.setVolume(1.0f);
    }

}
